@extends('mobile.template.bootstrap')
@section('title', '书籍详情')
@section('scripts')
<link rel="stylesheet" href="{{ asset('css/mobile-book.css') }}" />
@endsection
@section('top')
<div class="navbar  navbar-self">
	<div class="left">
		<a href="javascript:history.back();">
			<span class="fa fa-angle-left fa-fw fa-lg"></span>
		</a>
	</div>
	<div class="mid ">
		书籍详情
	</div>
	<div class="right">
		<a href="{{ url('/mobile/search') }}">
			<span class="fa fa-search fa-fw"></span>
		</a>
	</div>
</div>
@endsection
@section('content')

<section class="title">
	<div class="book-title">
		<img class="book-thumbnail" src="{{ $book->thumbnailUrl() }}" width="90" height="120">
		<div class="info">
			<h4 class="title">{{ $book->name }}</h4>
			<p>
				{{ $book->category->name }}<br>
				作者：{{ $book->author }}<br>
				（共{{ $book->sections->count() }}章）
			</p>
		</div>
	</div>
	<div class="btn-container">
		<div class="row">
			<div class="col-xs-5">
				<a href="{{ url('/mobile/books/'.$book->id.'/sections') }}" class="btn btn-default btn-block">
					<span class="fa fa-book"></span>
					章节目录
				</a>
			</div>
			<div class="col-xs-7" style="padding-left: 10px;">
				<a href="#" class="btn btn-danger btn-block disabled">
					<span class="fa fa-arrow-down"></span>
					TXT下载
				</a>
			</div>
		</div>
	</div>
</section>
<section class="info">
	<div class="info-container">
		<div class="tab-content">
			<div class="tab-pane active" id="abstract">
				{!! $book->abstract !!}
			</div>
		</div>
	</div>
</section>
<section class="new">
	<div class="flag-container dotdotdot-nowrap">
	@if($newSections->count() > 0)
		@foreach($newSections as $newSection)
		<a href="{{ url('/mobile/books/'.$book->id.'/sections/'.$newSection->order) }}">
			{{ $newSection->order }}、{{ $newSection->name }}
		</a>
		@if($loop->first)
		<span class="label label-lg label-success">最新</span>
		@endif
		<br />
		@endforeach
	@else
		暂无章节
	@endif
	</div>
</section>
<section class="more books-container">
	<div class="hotBook">
		<div class="row">
			<div class="col-xs-8">
				书籍推荐
			</div>
		</div>
	</div>
	<div class="books">
		@foreach($hotBooks as $hotBook)
		<div class="book">
			<div class="media">
				<div class="media-left">
					<a href="{{ url('/mobile/books/'.$hotBook->order) }}">
						<img class="book-thumbnail" class="media-object" src="{{ $hotBook->thumbnailUrl() }}" width="67.5" height="90"/>
					</a>
				</div>
				<div class="media-body">
					<div class="media-heading">
						<div class="title">
							<a href="{{ url('/mobile/books/'.$hotBook->order) }}">
								<h4 class="">{{ $hotBook->name }}</h4>
								<div class="text-muted">作者：{{ $hotBook->author }}</div>
							</a>
						</div>
						<div class="link">
							@if(Session::has($hotBook->id))
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/sections/'.Session::get($hotBook->id)) }}">
							@elseif(!is_null($hotBook->getFirstSection()))
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/sections/'.$hotBook->getFirstSection()->order) }}">
							@else
							<a class="btn btn-sm btn-default" href="{{ url('/mobile/books/'.$hotBook->id) }}">
							@endif
								立即阅读
							</a>
						</div>
					</div>
					<div class="content">
						<a href="{{ url('/mobile/books/'.$hotBook->id) }}" class="text-muted">
							{!! str_limit($hotBook->abstract, 200) !!}
						</a>
					</div>
				</div>
			</div>
		</div>
		@endforeach
	</div>
</section>
<section class="search">
	{!! Form::open(array('method' => 'GET', 'url' => 'mobile/search')) !!}
		<div class="form-group">
			<div class="input-group">
				<input type="text" class="form-control" name="keywords" placeholder="作者名/书名" value="" />
				<div class="input-group-addon" onclick="$(this).parent().parent('form').submit();">
					<a href="#"><span class="fa fa-fw fa-search"></span></a>
				</div>
			</div>
		</div>
	{!! Form::close() !!}
</section>
@endsection